package com.governtalk.backend.service;

import com.governtalk.backend.dto.question.QuestionDto;
import com.governtalk.backend.dto.question.QuestionCategoryDto;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;

public interface QuestionService {
    
    List<QuestionCategoryDto> getQuestionCategories();
    
    Page<QuestionDto> searchQuestions(String keyword, String type, String difficulty, 
                                    Long categoryId, String sortBy, String sortOrder, Pageable pageable);
    
    QuestionDto getQuestionDetail(Long questionId);
    
    Map<String, Object> submitAnswer(Long questionId, Map<String, Object> answer);
    
    void favoriteQuestion(Long questionId);
    
    Page<QuestionDto> getFavoriteQuestions(Pageable pageable);
    
    Page<Map<String, Object>> getAnswerHistory(Pageable pageable);
    
    QuestionDto createQuestion(QuestionDto questionDto);
    
    QuestionDto updateQuestion(Long questionId, QuestionDto questionDto);
    
    void deleteQuestion(Long questionId);
    
    Map<String, Object> importQuestions(MultipartFile file);
    
    // 在线练习相关方法
    List<QuestionDto> getPracticeQuestions(Long categoryId, Integer difficulty, String type, Integer count);
    
    Map<String, Object> submitPracticeAnswers(Map<String, Object> data);
    
    Page<Map<String, Object>> getPracticeHistory(Pageable pageable);
    
    // 搜索记录相关方法
    Map<String, Object> saveSearchHistory(Map<String, Object> data);
    Page<Map<String, Object>> getSearchHistory(Pageable pageable);
    List<Map<String, Object>> getRecentSearchHistory();
    Map<String, Object> clearSearchHistory();
}
